package com.woniuxy.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyMVConfiger implements WebMvcConfigurer {

       @Bean
       public WebMvcConfigurer crosConfiger(){
            return new WebMvcConfigurer() {
                @Override
                public void addCorsMappings(CorsRegistry registry) {
                    registry.addMapping("/**")//允许服务器端的哪些url处理跨域
                            .allowedOrigins("*")//允许哪些请求域
                            .allowedMethods("*")//允许哪些请求方式
                            .allowedHeaders("*");

                }
            };

       }
}
